package com.ebei.platform.restful;

import com.baomidou.mybatisplus.plugins.Page;
import com.ebei.platform.common.Constants;
import com.ebei.platform.common.StatusCode;
import com.ebei.platform.common.StatusCodeDesc;
import com.ebei.platform.common.util.RedisUtils;
import com.ebei.platform.common.util.RestfulConstants;
import com.ebei.platform.entity.User;
import com.ebei.platform.service.IUserService;
import com.ebei.platform.vo.ResultVO;
import com.ebei.platform.vo.UserParams;
import com.ebei.platform.vo.UserPassword;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * 用户Controller
 *
 * @author Victor.You@ebeitech
 * @version 1.0
 * @created 2018/6/1
 */

@RestController
@RequestMapping("/user1")
@Api(value = "用户")
public class UserInfo {

    @Autowired
    private IUserService userService;

    @Autowired
    private RedisUtils redisUtils;

    @ApiOperation(value = "按照用户ID获取用户详情", notes = "获取用户的详细信息")
    @GetMapping("/byId/{userId}")
    @ApiImplicitParams({@ApiImplicitParam(name = RestfulConstants.TOKEN_VALID_KEY, required = true, dataType = "string", paramType = "header"),
                        @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "String", paramType = "path")})
    public ResultVO<User> getByUserId(@PathVariable String userId) {
        User user = userService.selectById(userId);
        return new ResultVO<User>(StatusCode.SUCCESS,StatusCodeDesc.SUCCESS_DESC, user);
    }

}
